<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const user = {
        firstName: "li",
        lastName: "jack",
        get fullName() {
          //计算属性
          return `${this.lastName} ${this.firstName}`;
        },
        set fullName(value) {
          [this.lastName, this.firstName] = value.split(" ");
        },
      };
      // user.fullName("lili sun")
      user.fullName = "lili sun";
      console.log(user.lastName, user.firstName);
      console.log(user.fullName); //  "lili sun"
    </script>
  </body>
</html>
